import React, { Component, PropTypes } from 'react';
import { connect } from 'dva';
import { Link } from 'dva/router';
import styles from './index.scss';

function IndexPage({ location, dispatch, user }) {
  const onCountClick = () => {
    dispatch({
      type: 'user/click',
    });
  };
  return (
    <div className={styles.test}>
      <input type="button" value={`you clicked ${user.count} times333`} onClick={onCountClick} />111
    </div>
  );
}

IndexPage.propTypes = {
  location: PropTypes.object,
  dispatch: PropTypes.object,
  user: PropTypes.object,
};

IndexPage.defaultProps = {
  location: {},
  dispatch: {},
  user: {},
};

export default connect(({ user }) => ({ user }))(IndexPage);
